#include "ThreadPool.hpp"
#include "Log.hpp"
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <unistd.h>

int main()
{
    srand((unsigned int)time(nullptr));
    ThreadPool<Task>* tp = ThreadPool<Task>::getThreadPool(5);
    tp->Run();

    const char* options = "+-*/%";
    while(true)
    {
        int x = rand() % 100;
        int y = rand() % 100;
        int index = rand() % 5;
        Task t(x, y, options[index]);
        // 将任务推送到线程池的任务队列中
        logMessage(NORMAL, "Push A Task: %d %c %d = ?", x, options[index], y);
        tp->Push(t);
        sleep(1);
    }

    return 0;
}